import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import "normalize.css/normalize.css";
import { mavonEditor } from 'mavon-editor'

import '@/style/reset.css'
import '@/style/elementui.rewrite.css'

import 'mavon-editor/dist/css/index.css'
Vue.component('mavon-editor', mavonEditor)

Vue.use(ElementUI)
Vue.config.productionTip = false
ElementUI.Dialog.props.closeOnClickModal.default = false
const on = Vue.prototype.$on
// 防抖处理
Vue.prototype.$on = function (event, func) {
  let timer
  let newFunc = func
  if (event === 'click') {
    newFunc = function () {
      clearTimeout(timer)
      timer = setTimeout(function () {
        func.apply(this, arguments)
      }, 500)
    }
  }
  on.call(this, event, newFunc)
}

new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
